

using System;
using System.Text;

using NHibernate;
using NHibernate.Cfg;
using NHibernate.Criterion;
using NHibernate.Exceptions;

using NuevoGenNHibernate.EN.Ebay;
using NuevoGenNHibernate.CAD.Ebay;

namespace NuevoGenNHibernate.CEN.Ebay
{
public partial class PagoCEN
{
private IPagoCAD _IPagoCAD;

public PagoCEN(IPagoCAD _IPagoCAD)
{
        this._IPagoCAD = _IPagoCAD;
}

public IPagoCAD get_IPagoCAD ()
{
        return this._IPagoCAD;
}

public int CrearPago (NuevoGenNHibernate.Enumerated.Ebay.TipoDePagoEnum p_FormaDePago, float p_TotalPago, string p_usuario, int p_venta)
{
        PagoEN pagoEN = null;
        int oid;

        //Initialized PagoEN
        pagoEN = new PagoEN ();
        pagoEN.FormaDePago = p_FormaDePago;

        pagoEN.TotalPago = p_TotalPago;


        if (p_usuario != null) {
                pagoEN.Usuario = new NuevoGenNHibernate.EN.Ebay.UsuarioEN ();
                pagoEN.Usuario.Nick = p_usuario;
        }


        if (p_venta != -1) {
                pagoEN.Venta = new NuevoGenNHibernate.EN.Ebay.VentaEN ();
                pagoEN.Venta.Id_venta = p_venta;
        }

        //Call to PagoCAD

        oid = _IPagoCAD.CrearPago (pagoEN);
        return oid;
}

public PagoEN ReadOID (int id_Pago)
{
        PagoEN pagoEN = null;

        pagoEN = _IPagoCAD.ReadOID (id_Pago);
        return pagoEN;
}

public System.Collections.Generic.IList<PagoEN> ReadAll (int first, int size)
{
        System.Collections.Generic.IList<PagoEN> list = null;

        list = _IPagoCAD.ReadAll (first, size);
        return list;
}
}
}
